

local lime = require("lime")
lime.disableScreenCulling()
require("physics")
physics.start()
local ui = require("ui")
local remote = require("remote")
remote.startServer("8080")

local map = lime.loadMap("level1.tmx")

local onPlayerProperty = function(property, type, object)
    player = object.sprite
end
map:addPropertyListener("IsPlayer", onPlayerProperty)


local visual = lime.createVisual(map)

local physical = lime.buildPhysical(map)
map:setFocus(player)

local onUpdate = function(event)
physics.setGravity(100*remote.yGravity, 100*remote.xGravity)    
    
 map:update(event)
end

Runtime:addEventListener("enterFrame", onUpdate)


